<?php namespace Home\Controller;

use Framework\Kernel\Controller;
use Home\Model\Ans;
use Framework\Model\Db;

class AnswerController extends Controller{

	protected $an_s;

	public function __init()
	{
		$this->an_s = new Ans;
	}

	public function answer()
	{	
		if(empty($_SESSION['id']))
		{
			$this->error('请先登录',U('Index.index'));
		}
		else{
			if(!empty($_POST['content']))
			{
				if($this->an_s->ans())
				{
					$this->success('回答成功');
				}
				else{
					$this->error('请再来一次吧，亲');
				}
			}
			else{
				$this->error("请填写内容");
			}			
		}	
	}

}